package com.thoughtworks.studio.tools.cardkit.gui.figures;

import static org.jhotdraw.draw.AttributeKeys.STROKE_WIDTH;

import java.awt.geom.Point2D;

import org.jhotdraw.draw.LineFigure;
import org.jhotdraw.geom.Dimension2DDouble;
/**
 * A horizontal line with a preferred size of 1,1.
 *
 */
public class SeparatorLineFigure 
extends LineFigure {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 8856776410273387236L;
	/** Creates a new instance. */
    public SeparatorLineFigure() {
    }

    public void setBounds(Point2D.Double anchor, Point2D.Double lead) {
        setPoint(0, 0, anchor);
        setPoint(getNodeCount() - 1, 0, new Point2D.Double(lead.x, anchor.y));
    }
    public Dimension2DDouble getPreferredSize() {
        double width = Math.ceil(STROKE_WIDTH.get(this));
        return new Dimension2DDouble(width, width);
    }
}
